package com.sxpro;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

//TIP 要<b>运行</b>代码，请按 <shortcut actionId="Run"/> 或
// 点击装订区域中的 <icon src="AllIcons.Actions.Execute"/> 图标。
public class Main {
    public static void main(String[] args) {
        //TIP 当文本光标位于高亮显示的文本处时按 <shortcut actionId="ShowIntentionActions"/>
        // 查看 IntelliJ IDEA 建议如何修正。
        System.out.printf("Hello and welcome!");
    }
}

// 客户类
class Customer {
    private String name;
    private String contact;
    private String deliveryAddress;
    private boolean active;

    public Customer(String name, String contact, String deliveryAddress, boolean active) {
        this.name = name;
        this.contact = contact;
        this.deliveryAddress = deliveryAddress;
        this.active = active;
    }

    public String getName() {
        return name;
    }

    public String getContact() {
        return contact;
    }

    public String getDeliveryAddress() {
        return deliveryAddress;
    }

    public boolean isActive() {
        return active;
    }
}

// 订单状态枚举
enum OrderStatus {
    CREATE, PAID, SHIPPING, DELIVERED, CANCEL
}

// 订单类
class Order {
    private Date createDate;
    private OrderStatus status;
    private List<OrderDetail> orderDetails;

    public Order(Date createDate) {
        this.createDate = createDate;
        this.status = OrderStatus.CREATE;
        this.orderDetails = new ArrayList<>();
    }

    public void addOrderDetail(OrderDetail detail) {
        orderDetails.add(detail);
    }

    public List<OrderDetail> getOrderDetails() {
        return orderDetails;
    }

    public void setStatus(OrderStatus status) {
        this.status = status;
    }

    public OrderStatus getStatus() {
        return status;
    }
}

// 订单详情类
class OrderDetail {
    private Product product;
    private int quantity;

    public OrderDetail(Product product, int quantity) {
        this.product = product;
        this.quantity = quantity;
    }

    public double calculateSubTotal() {
        return product.getPriceForQuantity(quantity);
    }

    public double calculateWeight() {
        return product.getWeight() * quantity;
    }
}

// 商品项类
class Product {
    private String title;
    private double weight;
    private String description;
    private double price;

    public Product(String title, double weight, String description, double price) {
        this.title = title;
        this.weight = weight;
        this.description = description;
        this.price = price;
    }

    public double getPriceForQuantity(int quantity) {
        return price * quantity;
    }

    public double getWeight() {
        return weight;
    }

    // Getters
    public String getTitle() {
        return title;
    }

    public String getDescription() {
        return description;
    }
}

// 支付方式类
abstract class Payment {
    protected double amount;

    public Payment(double amount) {
        this.amount = amount;
    }

    public double getAmount() {
        return amount;
    }
}

// 信用卡类
class Credit extends Payment {
    private String number;
    private String type;
    private String expireDate;

    public Credit(double amount, String number, String type, String expireDate) {
        super(amount);
        this.number = number;
        this.type = type;
        this.expireDate = expireDate;
    }
}

// 现金类
class Cash extends Payment {
    private double cashTendered;

    public Cash(double amount, double cashTendered) {
        super(amount);
        this.cashTendered = cashTendered;
    }
}

// 在线转账类
class WireTransfer extends Payment {
    private String bankID;
    private String bankName;

    public WireTransfer(double amount, String bankID, String bankName) {
        super(amount);
        this.bankID = bankID;
        this.bankName = bankName;
    }
}

// 支付宝类
class AliPay extends Payment {
    private String number;

    public AliPay(double amount, String number) {
        super(amount);
        this.number = number;
    }
}

// 微信支付类
class WeixinPay extends Payment {
    private String number;

    public WeixinPay(double amount, String number) {
        super(amount);
        this.number = number;
    }
}